LassoScript Utility
Basics Browse Detail

[String->Digit]

Tag Link [String->Digit] Category String
Type Member Source Available No
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type Integer Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

Description

[String->Digit] returns the integer value of a specified character for a specified radix or -1 if the character is not defined for the specified radix. The character within the base string to be inspected is specified starting from 1 for the first character in the string.

A radix of 16 can be used to return the value of a hexadecimal digit (0-9 and A-F). A radix of 8 can be used to return the value of an octal digit (0-7). A radix of 2 can be used to return the value of a binary digit (0-1).

Syntax

[Output: 'FFFFFF'->(Digit: 4,16)]

<?LassoScript
Variable: 'myString' = '00001000';
Variable: 'Result' = $myString->(Digit: 5, 2);
?gt;

Parameters

Required Parameters
Position The character within the string to inspect.
Radix The radix of the result (e.g. 2 for binary, 8 for octal, 16 for hexadecimal).

Examples

To return the digit value for a character within a specific base:

Use the [String->Digit] tag. The following example returns the value of the fourth character in hexadecimal base 16. The result for C in base 16 is 12.

[Output: 'DEFC012'->(Digit: 4, 16)]

15

Related Tags

Category Tags